package com.quickdv.network;

import org.json.JSONObject;

import java.util.Map;

/**
 * Created by Administrator on 2015/6/3.
 */
public class HttpClientCon {


    String uri = "http://218.28.168.22:5180/timeShar/app/request.action";

//    public void post(com.alibaba.fastjson.JSONObject obj) {
//        BufferedReader in = null;
//        try {
//            HttpClient client = new DefaultHttpClient();
//            HttpPost request = new HttpPost(uri);
////            //使用NameValuePair来保存要传递的Post参数
//
//            //convert parameters into JSON object
////            JSONObject holder = getJsonObjectFromMap(params);
//
//            //passes the results to a string builder/entity
//            StringEntity se = new StringEntity(obj.toString());
//
//            //使用HttpPost对象来设置UrlEncodedFormEntity的Entity
//            request.setEntity(se);
//            HttpResponse response = client.execute(request);
//            in = new BufferedReader(
//                    new InputStreamReader(
//                            response.getEntity().getContent()));
//
//            StringBuffer string = new StringBuffer("");
//            String lineStr = "";
//            while ((lineStr = in.readLine()) != null) {
//                string.append(lineStr + "\n");
//            }
//            in.close();
//
//            String resultStr = string.toString();
//            Log.v("",resultStr);
//
//        } catch(Exception e) {
//            // Do something about exceptions
//            e.printStackTrace();
//        } finally {
//            if (in != null) {
//                try {
//                    in.close();
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }

   public JSONObject  getJsonObjectFromMap(Map<String,Object> params){
       return new JSONObject(params);
   }
}
